<?php


namespace app\library\model;


use app\library\facade\Config;

class Redis
{
    private static $insatance = null;

    private function __construct()
    {
        $redis = new \Redis();
        $redis->connect(Config::get('redis.host'), Config::get('redis.port'));
        $redis->auth(Config::get('redis.password'));
        $redis->select(Config::get('redis.index'));
        self::$insatance = $redis;
    }

    public static function getInstance(){
        if (null == self::$insatance) {
            new static();
        }
        return self::$insatance;
    }
}